home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- * *
- * TESample.h *
- * *
- * Header file for the TESample application. *
- * *
- * Copyright © 1988 Claris Corporation *
- * All Rights Reserved *
- * *
- ************************************************************************/
-
- /* TESample.c and TESample.r include this file. */
-
- /* ••• The following lines were added for XTND ••• */
-
- #define thePort qd.thePort
- #define screenBits qd.screenBits
- #define arrow qd.arrow
-
- #ifdef THINK_C
- /**
- Defines needed to compile in Think C
- **/
- #define DlgHookProcPtr ProcPtr
- #define ClikLoopProcPtr ProcPtr
- #define hfileInfo hFileInfo
-
- #define normal 0
- #define NIL 0L
- #define null 0L
- /* #define MAXLONG 0x7FFFFFFF */
- /* #define RGBColor _RGBColor */
-
- #else
- /**
- Minimum set of defines needed to compile in MPW
- **/
-
- #define black qd.black
- #define white qd.white
- #define gray qd.gray
- #define dkgray qd.dkGray
- #define hFileInfo hfileInfo /* Spelled wrong in MPW headers */
- #define PtoCstr p2cstr
-
- #define topLeft(r) (((Point *) &(r))[0])
- #define botRight(r) (((Point *) &(r))[1])
-
- /**
- Other stuff that is not defined by MPW
- **/
-
- #define NIL 0L
- #define null 0L
-
- #define MAX(a, b) (a > b ? a : b)
- #define MIN(a, b) (a < b ? a : b)
-
- #define WUNDERLINE 0x1000
- #define DUNDERLINE 0x2000
-
- #endif
-
-
- #define kTransVersion 2 /* Version of XTND used by TESample (Version 2 is XTND 1.3) */
-
- #define kPrefSize 512 /* Give the application enough memory to avoid running out */
- #define kMinSize 128
-
-
- /* ———— Defines for XTND resources ———— */
-
- #define clarisNames 25003 /* Claris names STR# resource */
- #define clarisFolder 1
- #define xtndNames 25004 /* XTND names STR# resource */
- #define clarisTranslators 1
- #define xtndSystem 2
-
-
- #ifndef __TE_Sample_Res__ /* Don't define this when included in TESample.r */
-
- /* A DocumentRecord contains the WindowRecord for one of our document windows,
- as well as the TEHandle for the text we are editing. Other document fields
- can be added to this record as needed. For a similar example, see how the
- Window Manager and Dialog Manager add fields after the GrafPort. */
- typedef struct {
- WindowRecord docWindow;
- TEHandle docTE;
- ControlHandle docVScroll;
- ControlHandle docHScroll;
- ProcPtr docClik;
- } DocumentRecord, *DocumentPeek;
-
- #endif
-
- /* ••• End of XTND additions ••• */
-
-
- /* The following constants are used to identify menus and their items. The menu IDs
- have an "m" prefix and the item numbers within each menu have an "i" prefix. */
- #define mApple 128 /* Apple menu */
- #define iAbout 1
-
- #define mFile 129 /* File menu */
- #define iNew 1
- #define iOpen 2
- #define iClose 4
- #define iSave 5
- #define iSaveAs 6
- #define iQuit 12
-
- #define mEdit 130 /* Edit menu */
- #define iUndo 1
- #define iCut 3
- #define iCopy 4
- #define iPaste 5
- #define iClear 6
-
- #define mFont 131
- /* Font menu - no items */
-
- #define mSize 132
- #define iPoints 1
- #define iSizeVal 2
-
- /* 1.01 - kTopLeft - This is for positioning the Disk Initialization dialogs. */
-
- #define kDITop 0x0050
- #define kDILeft 0x0070
-
- /* 1.01 - changed constants to begin with 'k' for consistency, except for resource IDs */
- /* kTextMargin is the number of pixels we leave blank at the edge of the window. */
- #define kTextMargin 2
-
- /* kMaxOpenDocuments is used to determine whether a new document can be opened
- or created. We keep track of the number of open documents, and disable the
- menu items that create a new document when the maximum is reached. If the
- number of documents falls below the maximum, the items are enabled again. */
- #define kMaxOpenDocuments 8
-
- /* kMaxDocWidth is an arbitrary number used to specify the width of the TERec's
- destination rectangle so that word wrap and horizontal scrolling can be
- demonstrated. */
- #define kMaxDocWidth 576
-
- /* kMinDocDim is used to limit the minimum dimension of a window when GrowWindow
- is called. */
- #define kMinDocDim 64
-
- /* kControlInvisible is used to 'turn off' controls (i.e., cause the control not
- to be redrawn as a result of some Control Manager call such as SetCtlValue)
- by being put into the contrlVis field of the record. kControlVisible is used
- the same way to 'turn on' the control. */
- #define kControlInvisible 0
- #define kControlVisible 0xFF
-
- /* kScrollbarAdjust and kScrollbarWidth are used in calculating
- values for control positioning and sizing. */
- #define kScrollbarWidth 16
- #define kScrollbarAdjust (kScrollbarWidth - 1)
-
- /* kScrollTweek compensates for off-by-one requirements of the scrollbars
- to have borders coincide with the growbox. */
- #define kScrollTweek 2
-
- /* kCrChar is used to match with a carriage return when calculating the
- number of lines in the TextEdit record. kDelChar is used to check for
- delete in keyDowns. */
- #define kCrChar 13
- #define kDelChar 8
-
- /* kButtonScroll is how many pixels to scroll horizontally when the button part
- of the horizontal scrollbar is pressed. */
- #define kButtonScroll 12
-
- /* kMaxTELength is an arbitrary number used to limit the length of text in the TERec
- so that various errors won't occur from too many characters in the text. */
- #define kMaxTELength 32000
-
- /* kSysEnvironsVersion is passed to SysEnvirons to tell it which version of the
- SysEnvRec we understand. */
- #define kSysEnvironsVersion 1
-
- /* kOSEvent is the event number of the suspend/resume and mouse-moved events sent
- by MultiFinder. Once we determine that an event is an OSEvent, we look at the
- high byte of the message sent to determine which kind it is. To differentiate
- suspend and resume events we check the resumeMask bit. */
- #define kOSEvent app4Evt /* event used by MultiFinder */
- #define kSuspendResumeMessage 1 /* high byte of suspend/resume event message */
- #define kResumeMask 1 /* bit of message field for resume vs. suspend */
- #define kMouseMovedMessage 0xFA /* high byte of mouse-moved event message */
- #define kNoEvents 0 /* no events mask */
-
- /* 1.01 - kMinHeap - This is the minimum result from the following
- equation:
-
- ORD(GetApplLimit) - ORD(ApplicZone)
-
- for the application to run. It will insure that enough memory will
- be around for reasonable-sized scraps, FKEYs, etc. to exist with the
- application, and still give the application some 'breathing room'.
- To derive this number, we ran under a MultiFinder partition that was
- our requested minimum size, as given in the 'SIZE' resource. */
-
- #define kMinHeap (29 * 1024)
-
- /* 1.01 - kMinSpace - This is the minimum result from PurgeSpace, when called
- at initialization time, for the application to run. This number acts
- as a double-check to insure that there really is enough memory for the
- application to run, including what has been taken up already by
- pre-loaded resources, the scrap, code, and other sundry memory blocks. */
-
- #define kMinSpace (20 * 1024)
-
- /* kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
- #define kExtremeNeg -32768
- #define kExtremePos (32767 - 1) /* required to address an old region bug */
-
- /* kTESlop provides some extra security when pre-flighting edit commands. */
- #define kTESlop 1024
-
- /* The following are indicies into STR# resources. */
- #define eWrongMachine 1
- #define eSmallSize 2
- #define eNoMemory 3
- #define eNoSpaceCut 4
- #define eNoCut 5
- #define eNoCopy 6
- #define eExceedPaste 7
- #define eNoSpacePaste 8
- #define eNoWindow 9
- #define eExceedChar 10
- #define eNoPaste 11
-
- /* Some CLSF errors */
-
- #define eTranslatorOpen 12
- #define eTranslatorLoad 13
- #define eResFailed 14
- #define eResReadFail 15
- #define eDocOpenFail 16
- #define eDocReadFail 17
- #define eDeleteFailed 18
- #define eCreateFail 19
- #define eOpenFail 20
-
- #define rMenuBar 128 /* application's menu bar */
- #define rAboutAlert 128 /* about alert */
- #define rUserAlert 129 /* user error alert */
- #define rDocWindow 128 /* application's window */
- #define rVScroll 128 /* vertical scrollbar control */
- #define rHScroll 129 /* horizontal scrollbar control */
- #define kErrStrings 128 /* error string list */
-